package com.youlai.boot.core.tenant.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.youlai.boot.core.tenant.mapper.TenantDatasourceMapper;
import com.youlai.boot.core.tenant.model.entity.TenantDatasource;
import com.youlai.boot.core.tenant.service.TenantDatasourceService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 租户数据源服务实现类
 */
@Service
public class TenantDatasourceServiceImpl extends ServiceImpl<TenantDatasourceMapper, TenantDatasource> implements TenantDatasourceService {

    @Override
    public List<TenantDatasource> listEnabled() {
        return this.list(new LambdaQueryWrapper<TenantDatasource>()
                .eq(TenantDatasource::getStatus, 1) // 启用状态
                .eq(TenantDatasource::getIsDeleted, 0) // 未删除
        );
    }
}
